package com.example.emos.wx.db.pojo;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import java.io.Serializable;
import java.util.Date;

/**
 * @Author yctc
 * @Date 2021/4/3 21:18
 * @Version 1.0
 */

/**
 * ORM映射
 */
@Data
@Document(collection = "message") // 表明映射关系，对应MongDB中的message集合
public class MessageEntity implements Serializable {
    @Id // 主键
    private String _id;

    @Indexed(unique = true) // 唯一性约束
    private String uuid;

    @Indexed // 发送人ID,普通索引
    private Integer senderId;

    //发送人URL
    private String senderPhoto = "https://static-1258386385.cos.ap-beijing.myqcloud.com/img/System.jpg";

    // 发送人 name
    private String senderName;

    @Indexed // 发送时间
    private Date sendTime;

    // 信息正文
    private String msg;
}
